// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env: 'wx-shopping-zbs'
})
const db = cloud.database()
const _ = db.command
// 云函数入口函数
exports.main = async (event, context) => {
  try {
    return await db.collection("Chat").doc(event.id).update({
      data: {
        Openids:event.Openids,
        Times:event.Times,
        Titles:event.Titles
      }
    })
  } catch (e) {
    console.error(e)
  }

  return {
    event,
    openid: wxContext.OPENID,
    appid: wxContext.APPID,
    unionid: wxContext.UNIONID,
  }
}